<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreatePackDownLog extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('pack_down_log', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('event_id')->comment('事件id')->nullable(false)->default(0)->index('event_id');
            $table->char('hash',32)->comment('下载使用的hash码，唯一')->nullable(false)->default('');
            $table->string('file_name', 255)->comment('文件名')->nullable(false)->default('');
            $table->string('event_name', 32)->comment('事件名称')->nullable(false)->default('');
            $table->string('created_by',32)->comment('创建人')->nullable(false)->default('');
            $table->integer('created_id')->comment('创建人id')->nullable(false)->default(0);
            $table->string('path',255)->comment('文件所在路径（相对）')->nullable(false)->default('');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('pack_down_log');
    }
}
